//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Text;
using Eas.WebCrawler.Interfaces;

namespace Eas.WebCrawler.Test.PlugIns {
    public static class RequestHelper {
        /*public static Request rGoogle = new Request(UriHelper.Google, null);
        public static Request rYahoo = new Request(UriHelper.Yahoo, null);
        public static Request rMSN = new Request(UriHelper.Msn, null);
        public static Request rMicrosoft = new Request(UriHelper.Microsoft, null);
        public static Request rPartial = new Request(UriHelper.Partial, rGoogle);
        public static Request rDeepPartial = new Request(UriHelper.DeepPartial, rGoogle);
        public static Request r2Deep = new Request(UriHelper.Yahoo, rPartial);
        public static Request r3Deep = new Request(UriHelper.Msn, r2Deep);
        public static Request r4Deep = new Request(UriHelper.Microsoft, r3Deep);
        
        public static Request rHtmlRef = new Request(UriHelper.HtmlRef, null);
        public static Request rPhpRef = new Request(UriHelper.PhpRef);
        */
        public static Request rMixedCaseAspNet = new Request(UriHelper.MixedCaseAspNet);
        public static Request rMixedCaseFroogle = new Request(UriHelper.MixedCaseFroogle);

        public static Request rGoogle = new Request(UriHelper.Google, null);
        public static Request rYahoo = new Request(UriHelper.Yahoo, null);
        public static Request rMSN = new Request(UriHelper.Msn, null);
        public static Request rMicrosoft = new Request(UriHelper.Microsoft, null);
        public static Request rPartial = new Request(UriHelper.Partial, rGoogle);
        public static Request rDeepPartial = new Request(UriHelper.DeepPartial, rGoogle);
        public static Request r2Deep = new Request(UriHelper.Yahoo, rPartial);
        public static Request r3Deep = new Request(UriHelper.Msn, r2Deep);
        public static Request r4Deep = new Request(UriHelper.Microsoft, r3Deep);

        public static Request rHtmlRef = new Request(UriHelper.HtmlRef, null);
        public static Request rPhpRef = new Request(UriHelper.PhpRef);
        internal static int _CurrentRequest = 0;
        internal static object _Lock = new object();
        public static Request[] AllRequests = new Request[]{
            rGoogle,
            rYahoo,
            rMSN,
            rMicrosoft,
            rPartial,
            rDeepPartial,
            r2Deep,
            r3Deep,
            r4Deep,
            rHtmlRef,
            rPhpRef
        };

        public static Request GetNextRequest() {
            lock (_Lock) {
                ++_CurrentRequest;
                if (_CurrentRequest >= AllRequests.Length)
                    _CurrentRequest = 0;
                return AllRequests[_CurrentRequest];
            }
        }
    }
}
